<template>
    <div style="padding-top: 59px;">
        <div class="top-panel w" style="padding: 0px 15px; margin-top: 20px;">
            <div class="clearfix">
                <div class="title-big fl">个人中心<span class="title-tip">在这里，可以集中管理维护您的用户、账号等信息</span></div>
                <div class="fr" style="padding-top: 20px;">账号身份：  <span class="font-color margin_r20">{{(utype == 1)?'个人':'企业'}}</span></div>
            </div>
        </div>
        <div class="mtb-large">
            <div class="w">
                <el-row :gutter="20">
                    <el-col :span="5">
                        <div class="left-menu-box panel-bg" style="padding-bottom:25px;">
                            <ul class="menus">
                                <li v-for="(item,index) in menulist" :key="index">
                                    <h4>{{item.type}}</h4>
                                    <ul class="submenus">
                                        <li @click="handselect" v-for="(level,ind) in item.level" :key="ind">
                                            <router-link :to="level.path">{{level.name}}</router-link>
                                        </li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </el-col>
                    <el-col :span="19">
                        <router-view v-if="routerAlive"></router-view>
                    </el-col>
                </el-row>
            </div>
        </div>



    </div>
</template>

<script>

    import '../../../assets/css/workbench.css'
    import '../../../assets/css/capitalaccount.css'
    import '../../../assets/css/projects.css'
    import '../../../assets/css/ucenter.css'
    export default {
        data(){
            return{
                routerAlive: true,  //渲染状态
                menulist: [],
                utype: 0,  //账号身份
            }
        },
        methods: {
            // 切换菜单选项
            handselect(){
                this.routerAlive = false;
                this.$nextTick(()=>{
                    this.routerAlive = true;
                });
            },
            init(){
                this.utype = window.localStorage.utype;
                if(this.utype == 1){  //个人账号
                    this.menulist = [
                        {
                            'type' :'资料设置',
                            'level' :[
                                {'name': '基本信息','path': '/personalinfo'},
                                {'name': '技能信息','path': '/skill/skillinfo'},
                                {'name': '实名认证','path': '/personalauth'},
                                {'name': '账号绑定','path': '/accoutbind'},
                                {'name': '项目案例','path': '/case'},
                            ]
                        },
                        {
                            'type' :'我的积分',
                            'level' :[
                                {'name': '积分任务','path': '/integral'},
                                {'name': '积分记录','path': '/integralrecord'},
                            ]
                        },
                        // {
                        //     'type' :'合作评价',
                        //     'level' :[
                        //         {'name': '我的评价','path': '/evaluate'},
                        //     ]
                        // },
                    ];
                }else if(this.utype == 2){  //企业账号
                    this.menulist = [
                        {
                            'type' :'资料设置',
                            'level' :[
                                {'name': '企业信息','path': '/company'},
                                {'name': '技能信息','path': '/skill/skillinfo'},
                                {'name': '企业认证','path': '/companyauth'},
                                {'name': '账号绑定','path': '/accoutbind'},
                                {'name': '项目案例','path': '/case'},
                            ]
                        },
                        {
                            'type' :'我的积分',
                            'level' :[
                                {'name': '积分任务','path': '/integral'},
                                {'name': '积分记录','path': '/integralrecord'},
                            ]
                        },
                        {
                            'type' :'合作评价',
                            'level' :[
                                {'name': '我的评价','path': '/evaluate'},
                            ]
                        },
                    ];
                }
            },
        },
        mounted(){
            this.init();
        },
    }
</script>
